Left Termination of the query pattern query_in_1(g) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

append(nil, XS, XS).
append(cons(X, XS), YS, cons(X, ZS)) :- append(XS, YS, ZS).
reverse(nil, nil).
reverse(cons(X, nil), cons(X, nil)).
reverse(cons(X, XS), YS) :- ','(reverse(XS, ZS), append(ZS, cons(X, nil), YS)).
shuffle(nil, nil).
shuffle(cons(X, XS), cons(X, YS)) :- ','(reverse(XS, ZS), shuffle(ZS, YS)).
query(XS) :- shuffle(cons(X, XS), YS).

Queries:

query(g).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
query_in: (b)
shuffle_in: (b,f)
reverse_in: (b,f)
append_in: (b,b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

QUERY_IN_G(XS) → U6_G(XS, shuffle_in_ga(cons(X, XS), YS))
QUERY_IN_G(XS) → SHUFFLE_IN_GA(cons(X, XS), YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → REVERSE_IN_GA(XS, ZS)
REVERSE_IN_GA(cons(X, XS), YS) → U2_GA(X, XS, YS, reverse_in_ga(XS, ZS))
REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_GA(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → APPEND_IN_GGA(ZS, cons(X, nil), YS)
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → U1_GGA(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_GA(X, XS, YS, shuffle_in_ga(ZS, YS))
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
U1_GGA(x1, x2, x3, x4, x5)  =  U1_GGA(x5)
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x4)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)
U6_G(x1, x2)  =  U6_G(x2)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
QUERY_IN_G(x1)  =  QUERY_IN_G(x1)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x4)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

QUERY_IN_G(XS) → U6_G(XS, shuffle_in_ga(cons(X, XS), YS))
QUERY_IN_G(XS) → SHUFFLE_IN_GA(cons(X, XS), YS)
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))
SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → REVERSE_IN_GA(XS, ZS)
REVERSE_IN_GA(cons(X, XS), YS) → U2_GA(X, XS, YS, reverse_in_ga(XS, ZS))
REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_GA(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
U2_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → APPEND_IN_GGA(ZS, cons(X, nil), YS)
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → U1_GGA(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_GA(X, XS, YS, shuffle_in_ga(ZS, YS))
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
U1_GGA(x1, x2, x3, x4, x5)  =  U1_GGA(x5)
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x4)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)
U6_G(x1, x2)  =  U6_G(x2)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)
QUERY_IN_G(x1)  =  QUERY_IN_G(x1)
U3_GA(x1, x2, x3, x4)  =  U3_GA(x4)
U2_GA(x1, x2, x3, x4)  =  U2_GA(x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 3 SCCs with 8 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

APPEND_IN_GGA(cons(X, XS), YS, cons(X, ZS)) → APPEND_IN_GGA(XS, YS, ZS)

R is empty.
The argument filtering Pi contains the following mapping:
cons(x1, x2)  =  cons(x2)
APPEND_IN_GGA(x1, x2, x3)  =  APPEND_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

APPEND_IN_GGA(cons(XS), YS) → APPEND_IN_GGA(XS, YS)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

REVERSE_IN_GA(cons(X, XS), YS) → REVERSE_IN_GA(XS, ZS)

R is empty.
The argument filtering Pi contains the following mapping:
cons(x1, x2)  =  cons(x2)
REVERSE_IN_GA(x1, x2)  =  REVERSE_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

REVERSE_IN_GA(cons(XS)) → REVERSE_IN_GA(XS)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)

The TRS R consists of the following rules:

query_in_g(XS) → U6_g(XS, shuffle_in_ga(cons(X, XS), YS))
shuffle_in_ga(nil, nil) → shuffle_out_ga(nil, nil)
shuffle_in_ga(cons(X, XS), cons(X, YS)) → U4_ga(X, XS, YS, reverse_in_ga(XS, ZS))
reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
U4_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U5_ga(X, XS, YS, shuffle_in_ga(ZS, YS))
U5_ga(X, XS, YS, shuffle_out_ga(ZS, YS)) → shuffle_out_ga(cons(X, XS), cons(X, YS))
U6_g(XS, shuffle_out_ga(cons(X, XS), YS)) → query_out_g(XS)

The argument filtering Pi contains the following mapping:
query_in_g(x1)  =  query_in_g(x1)
U6_g(x1, x2)  =  U6_g(x2)
shuffle_in_ga(x1, x2)  =  shuffle_in_ga(x1)
cons(x1, x2)  =  cons(x2)
nil  =  nil
shuffle_out_ga(x1, x2)  =  shuffle_out_ga(x2)
U4_ga(x1, x2, x3, x4)  =  U4_ga(x4)
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
query_out_g(x1)  =  query_out_g
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

SHUFFLE_IN_GA(cons(X, XS), cons(X, YS)) → U4_GA(X, XS, YS, reverse_in_ga(XS, ZS))
U4_GA(X, XS, YS, reverse_out_ga(XS, ZS)) → SHUFFLE_IN_GA(ZS, YS)

The TRS R consists of the following rules:

reverse_in_ga(nil, nil) → reverse_out_ga(nil, nil)
reverse_in_ga(cons(X, nil), cons(X, nil)) → reverse_out_ga(cons(X, nil), cons(X, nil))
reverse_in_ga(cons(X, XS), YS) → U2_ga(X, XS, YS, reverse_in_ga(XS, ZS))
U2_ga(X, XS, YS, reverse_out_ga(XS, ZS)) → U3_ga(X, XS, YS, append_in_gga(ZS, cons(X, nil), YS))
U3_ga(X, XS, YS, append_out_gga(ZS, cons(X, nil), YS)) → reverse_out_ga(cons(X, XS), YS)
append_in_gga(nil, XS, XS) → append_out_gga(nil, XS, XS)
append_in_gga(cons(X, XS), YS, cons(X, ZS)) → U1_gga(X, XS, YS, ZS, append_in_gga(XS, YS, ZS))
U1_gga(X, XS, YS, ZS, append_out_gga(XS, YS, ZS)) → append_out_gga(cons(X, XS), YS, cons(X, ZS))

The argument filtering Pi contains the following mapping:
cons(x1, x2)  =  cons(x2)
nil  =  nil
reverse_in_ga(x1, x2)  =  reverse_in_ga(x1)
reverse_out_ga(x1, x2)  =  reverse_out_ga(x2)
U2_ga(x1, x2, x3, x4)  =  U2_ga(x4)
U3_ga(x1, x2, x3, x4)  =  U3_ga(x4)
append_in_gga(x1, x2, x3)  =  append_in_gga(x1, x2)
append_out_gga(x1, x2, x3)  =  append_out_gga(x3)
U1_gga(x1, x2, x3, x4, x5)  =  U1_gga(x5)
U4_GA(x1, x2, x3, x4)  =  U4_GA(x4)
SHUFFLE_IN_GA(x1, x2)  =  SHUFFLE_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ RuleRemovalProof

Q DP problem:
The TRS P consists of the following rules:

U4_GA(reverse_out_ga(ZS)) → SHUFFLE_IN_GA(ZS)
SHUFFLE_IN_GA(cons(XS)) → U4_GA(reverse_in_ga(XS))

The TRS R consists of the following rules:

reverse_in_ga(nil) → reverse_out_ga(nil)
reverse_in_ga(cons(nil)) → reverse_out_ga(cons(nil))
reverse_in_ga(cons(XS)) → U2_ga(reverse_in_ga(XS))
U2_ga(reverse_out_ga(ZS)) → U3_ga(append_in_gga(ZS, cons(nil)))
U3_ga(append_out_gga(YS)) → reverse_out_ga(YS)
append_in_gga(nil, XS) → append_out_gga(XS)
append_in_gga(cons(XS), YS) → U1_gga(append_in_gga(XS, YS))
U1_gga(append_out_gga(ZS)) → append_out_gga(cons(ZS))

The set Q consists of the following terms:

reverse_in_ga(x0)
U2_ga(x0)
U3_ga(x0)
append_in_gga(x0, x1)
U1_gga(x0)

We have to consider all (P,Q,R)-chains.
By using the rule removal processor [15] with the following polynomial ordering [25], at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

U4_GA(reverse_out_ga(ZS)) → SHUFFLE_IN_GA(ZS)
SHUFFLE_IN_GA(cons(XS)) → U4_GA(reverse_in_ga(XS))


Used ordering: POLO with Polynomial interpretation [25]:

POL(SHUFFLE_IN_GA(x1)) = 2 + 2·x1   
POL(U1_gga(x1)) = 2 + x1   
POL(U2_ga(x1)) = 2 + x1   
POL(U3_ga(x1)) = x1   
POL(U4_GA(x1)) = 2·x1   
POL(append_in_gga(x1, x2)) = 1 + x1 + x2   
POL(append_out_gga(x1)) = 2 + x1   
POL(cons(x1)) = 2 + x1   
POL(nil) = 1   
POL(reverse_in_ga(x1)) = 2 + x1   
POL(reverse_out_ga(x1)) = 2 + x1   



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ RuleRemovalProof
QDP
                            ↳ PisEmptyProof

Q DP problem:
P is empty.
The TRS R consists of the following rules:

reverse_in_ga(nil) → reverse_out_ga(nil)
reverse_in_ga(cons(nil)) → reverse_out_ga(cons(nil))
reverse_in_ga(cons(XS)) → U2_ga(reverse_in_ga(XS))
U2_ga(reverse_out_ga(ZS)) → U3_ga(append_in_gga(ZS, cons(nil)))
U3_ga(append_out_gga(YS)) → reverse_out_ga(YS)
append_in_gga(nil, XS) → append_out_gga(XS)
append_in_gga(cons(XS), YS) → U1_gga(append_in_gga(XS, YS))
U1_gga(append_out_gga(ZS)) → append_out_gga(cons(ZS))

The set Q consists of the following terms:

reverse_in_ga(x0)
U2_ga(x0)
U3_ga(x0)
append_in_gga(x0, x1)
U1_gga(x0)

We have to consider all (P,Q,R)-chains.
The TRS P is empty. Hence, there is no (P,Q,R) chain.